package tichu_project252.View;

import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import tichu_project252.Model.Model;

/**
 * This class connects View with model. 
 * It also initialize  a new GameFrame.
 * 
 * @author Alexandra Barka, ΑΜ: 2867, login : barka.
 * @version %I%, %G%
 */

public class View {
    
    private GameFrame game = null;
       /**
     * Constructs a new game window.
     *
     * <p><b>Constructor: </b>   </p>
     *
     * <p><b>Precondition: </b> </p> <p><b>Postcondition: </b> Constructs a new
     * Game Frame (or game window) </p>
     *
     * @param m The model
     * @throws Exception : if something goes wrong
     */
    
    public View(Model m) throws Exception {


        try {
            game = new GameFrame(m);
        } catch (IOException ex) {
            Logger.getLogger(GameFrame.class.getName()).log(Level.SEVERE, null, ex);
        }

        game.setVisible(true);
    }
    /**
     * Returns the GameFrame.
     *
     * <p> <b> Accessor: </b>  GameFrame getFrame()</p>
     *
     * <p><b> Precondition: </b> </p> <p> <b>
     * Postcondition:</b> Returns the GameFrame </p>
     *
     * @return the GameFrame
     */
    public GameFrame getFrame() {
        return game;
    }
}
